<div class="JO_left">



	<?

		if( $_REQUEST[ "SO_content_key" ] ) {

			$query = "
				SELECT	*
				FROM	`content`
				WHERE	`key` = '" . $_REQUEST[ "SO_content_key" ] . "'
			";

			$recordSet = JO_query( $query );

			if( $recordSet -> num_rows ) $record = $recordSet -> fetch_array( );

		}

	?>



	<!-- Form -->

		<form
			action	= "JO_71_SO/SO_05_execution.php"
			target	= "JO_integration_asynchronous"
			method	= "post"
			class	= "JO_bar_720"
		>

			<input type="hidden" name="SO_query"		value="content_<?= empty( $_REQUEST[ "SO_content_key" ] ) ? "insert" : "update" ?>"	/>
			<input type="hidden" name="SO_content_key"	value="<?= $_REQUEST[ "SO_content_key" ] ?>"										/>

			<h1><?= empty( $_REQUEST[ "SO_content_key" ] ) ? "Insert" : "Update" ?> a Content</h1>

			<div>

				<table>

					<tr>
						<th style="width: 81px;">Unit</th>
						<td>

							<select name="SO_content_unit" style="width: 584px;">

								<option>																	</option> <!-- non publishment -->
								<option <?= $record[ "unit" ] == "notice"	? "selected" : "" ?>>notice		</option>
								<option <?= $record[ "unit" ] == "magazine"	? "selected" : "" ?>>magazine	</option>
								<option <?= $record[ "unit" ] == "neowiz"	? "selected" : "" ?>>neowiz		</option>

							</select>

						</td>
					</tr>

					<tr>
						<th>Subject</th>
						<td>

							<input
								type	= "text"
								name	= "SO_content_subject"
								value	= "<?= $record[ "subject" ] ?>"
								style	= "width: <?= $JO_MSIE ? 569 : 571 ?>px;"
							 />

						</td>
					</tr>

					<tr>
						<th style="padding-top: 12px; vertical-align: top;">Content</th>
						<td>

							<textarea
								name	= "SO_content_content"
								style	= "width: 567px; height: <?= substr_count( $record[ "content" ], "\r\n" ) ? substr_count( $record[ "content" ], "\r\n" ) * 16 : 16 ?>px;"
								onkeyup	= "this.style.height = ( this.value.split( '\n' ).length * 16 ) + 'px'";"
							><?= $record[ "content" ] ?></textarea>

						</td>
					</tr>

					<tr>
						<th>Image</th>
						<td>

							<input
								type	= "text"
								name	= "SO_content_image"
								value	= "<?= $record[ "image" ] ?>"
								style	= "width: <?= $JO_MSIE ? 569 : 571 ?>px;"
							 />

						</td>
					</tr>

					<tr>
						<th>Insert</th>
						<td>

							<input
								type	= "text"
								name	= "SO_index_insert"
								value	= "<?= $record[ "insert" ] ?>"
								style	= "width: <?= $JO_MSIE ? 569 : 571 ?>px;"
							 />

						</td>
					</tr>

					<tr>
						<th>Delete</th>
						<td>

							<input
								type	= "text"
								name	= "SO_index_delete"
								value	= "<?= $record[ "delete" ] ?>"
								style	= "width: <?= $JO_MSIE ? 569 : 571 ?>px;"
							 />

						</td>
					</tr>

					<tr>
						<th style	= "border-bottom: 1px solid #FFFFFF; background-color: #FFFFFF;"></th>
						<td style	= "border-bottom: 1px solid #FFFFFF; background-color: #FFFFFF;">

							<input
								type	= "submit"
								value	= "<?= empty( $_REQUEST[ "SO_content_key" ] ) ? "Insert" : "Update" ?> a Content"
								class	= "JO_button"
								style	= "width: 584px;"
							/>

						</td>
					</tr>

				</table>

			</div>

		</form>



	<!-- List -->

		<div class="JO_bar_720">

			<h1>Content List</h1>

			<div>

				<table style="margin: 2px 3px 1px -3px;">

					<tr>
						<th style="width: 49px;">Key		</th>
						<th style="width: 65px;">Unit		</th>
						<th						>Subject	</th>
						<th style="width: 89px;">Insert		</th>
						<th style="width: 89px;">Update	</th>
					</tr>

					<?

						$query = "
							SELECT		*
							FROM		`content`
							WHERE		`delete` IS NULL
							ORDER BY	`key` DESC
						";

						$recordSet = JO_query( $query );

						if( $recordSet -> num_rows ) while( $record = $recordSet -> fetch_array( ) ) {

					?>

						<tr>

							<td class="JO_right"><?= $record[ "key" ] ?></td>

							<td><?= $record[ "unit" ] ?></td>

							<td><a href="?SO_unit=12_content&SO_content_key=<?= $record[ "key" ] ?>"><?= $record[ "subject"	] ?></a></td>

							<td><?= substr( $record[ "insert" ], 0, 16 ) ?></td>

							<td><?= substr( $record[ "update" ], 0, 16 ) ?></td>

						</tr>

					<? } ?>

				</table>

			</div>

		</div>



</div>
